<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.eleapmob.information.news.NodeBean"%>
<%@page import="com.eleapmob.information.utils.ComparatorTime"%>
<%@page import="com.eleapmob.information.utils.XmlUtil"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.eleapmob.information.news.News"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'new.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" href="style/style_content.css" type="text/css"></link>
		<link rel="stylesheet" href="style/style_frame.css" type="text/css"></link>
		<script type="text/javascript"></script>
		<script type='text/javascript' src='/busmap/dwr/interface/service.js'></script>
		<script type='text/javascript' src='/busmap/dwr/engine.js'></script>
		<script type="text/javascript">
			num=15;
			time=new Date();
			function message(){
				document.getElementById("more").value="加载中...";
				service.findNum(num,function rollback(data){
					document.getElementById("more").value="更多";
					for(i=0;i<data.length;i++){
					time=data[i].time;
						str="<div class='contentInner'><a href="+data[i].link+"><p/><div class='main_news_container'><div class='news_main_content_text'>"
						+"<br/><h3>"+data[i].title+"</h3><h4>"+time.pattern("yyyy-MM-dd hh:mm:ss")+"<br/>"+data[i].rescription+"</h4><p/></div></div></a></div>";
						document.getElementById("message").innerHTML=document.getElementById("message").innerHTML+str;
					}
					time=data[0].time;
				});
				if(num==60){
					document.getElementById("more").value="";
				}
				num=num+15;
			}
			Date.prototype.pattern=function(fmt) {  
    		var o = {  
    		"M+" : this.getMonth()+1, //月份  
    		"d+" : this.getDate(), //日  
   	 	"h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时  
   		"H+" : this.getHours(), //小时  
   	 	"m+" : this.getMinutes(), //分  
   	 	"s+" : this.getSeconds(), //秒  
    	"q+" : Math.floor((this.getMonth()+3)/3), //季度  
    	"S" : this.getMilliseconds() //毫秒  
    	};  
    	var week = {  
    	"0" : "\u65e5",  
    	"1" : "\u4e00",  
    	"2" : "\u4e8c",  
    	"3" : "\u4e09",  
    	"4" : "\u56db",  
    	"5" : "\u4e94",  
    	"6" : "\u516d"  
    	};  
    	if(/(y+)/.test(fmt)){  
       fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));  
    	}  
    	if(/(E+)/.test(fmt)){  
        fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "\u661f\u671f" : "\u5468") : "")+week[this.getDay()+""]);  
    	}  
    	for(var k in o){  
        if(new RegExp("("+ k +")").test(fmt)){  
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));  
        }  
    	}  
    return fmt;  
}  
		</script>
	</head>

	<body>
		<div id="container" class="maincontainer">
			<!-- tag:内容区块:新闻 -->
			<div class="contentTitleContainer" style="width: 99%">
				<table class="forword">
					<tr>
						<td>
							<div class="navmenu" style="width: 99%">
								<a href="information/index.jsp">关注</a>
								<a href="information/news.jsp">新闻</a>
								<a href="information/electron.jsp">娱乐</a>
								<a href="information/sports.jsp">体育</a>
								<a href="information/recreation.jsp">科技</a>
							</div>
						</td>
					</tr>
				</table>
			</div>
			<div id="message">
				<%
				String name=(String)request.getParameter("");
				News news = new News();
				List<NodeBean> list=news.findAll();
				
				SimpleDateFormat s=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
				//Collections.shuffle(list);
				
				for(int i=list.size()-1;i>=list.size()-15;i--){
					NodeBean bean=list.get(i);
			 %>
				<div class="contentInner" style="width: 99%">

					<a href="<%=bean.getLink() %>">
						<div class="main_news_container" style="width: 99%">
							<div class="news_main_content_text" style="width: 99%">
								<br />
								<h3><%=bean.getTitle() %></h3>
								<h4><%=s.format(bean.getTime())%><br /><%=XmlUtil.getDesc(bean.getRescription()) %></h4>
							</div>
						</div> </a>
				</div>
				<%} %>
			</div>
		</div>

		<input type="button" id="more" value="更  多" onclick="message()"
			style="font-size: 40px; height: 60; width: 100%" />
	</body>
</html>
